app.controller('HomeCtrl', ['$scope', '$http', 'GoodsService', function($scope, $http, GoodsService){

	//分类
	$scope.classData = [
		{
			title:'每日必抢',
			Img:'home/imgs/class01.png'
		},
		{
			title:'鲜货直供',
			Img:'home/imgs/class02.png'
		},
		{
			title:'乳品',
			Img:'home/imgs/class03.png'
		},
		{
			title:'整箱购',
			Img:'home/imgs/class04.png'
		}
	];

	// bannerFood
	$scope.bannerFoodData = ['home/imgs/Z.jpg', 'home/imgs/Y.jpg', 'home/imgs/X.jpg'];

	// 家庭业务footer
	$scope.homeBusinessData = [
		{
			title:'牛奶面包',
			Img:'home/imgs/nnmb.png'
		},
		{
			title:'饮料酒水',
			Img:'home/imgs/yljs.png'
		},
		{
			title:'优选水果',
			Img:'home/imgs/yxsg.png'
		},
		{
			title:'更多',
			Img:'home/imgs/gd.png'
		}

	];

	// 获取数据home.json
	$http.get('data/home.json').then(function(res){
		$scope.allData = res.data.data;
		console.log($scope.allData);

		// squareMian数据
		$scope.goods = $scope.allData.act_info[5].act_rows;
		console.log($scope.goods);
	});

	//添加商品
	$scope.add = function(){
		GoodsService.addGood(this.good);
        console.log(GoodsService.allGoods());
	}

}])